//
//  TZUICollectionHeader.m
//  X-Tribe
//
//  Created by my-pc on 16/3/29.
//  Copyright © 2016年 Miss.Ou. All rights reserved.
//

#import "TZUICollectionHeader.h"
@interface TZUICollectionHeader()

@property(nonatomic,weak)UIButton *righBtn;
@end
@implementation TZUICollectionHeader
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        UILabel *label = [[UILabel alloc]init];
        label.textColor = [UIColor blackColor];
        label.frame = CGRectMake(10 , 0 , 100, 40);
        
        [self addSubview:label];
        self.littleLabel = label;
        
        self.backgroundColor = [UIColor colorWithRed:0.86 green:0.86 blue:0.86 alpha:1.00];
        
        //右侧更多按钮
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:btn];
        [btn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.right.mas_equalTo(0);
            make.size.equalTo(label);
        }];
        btn.backgroundColor = [UIColor clearColor];
        [btn setTitle:@"更多" forState:UIControlStateNormal];
        [btn setTitleColor:[UIColor colorWithRed:1.00 green:0.51 blue:0.00 alpha:1.00] forState:UIControlStateSelected];
        [btn addTarget:self action:@selector(btnAction) forControlEvents:UIControlEventTouchUpInside];
        self.righBtn = btn;
        
    }
    return self;
    
}
-(void)btnAction{

    [self.collectionHeaderDelegate moreBtnAction];
}
-(void)setHidden:(BOOL)hidden
{
    if (!hidden) {
        [self.righBtn removeFromSuperview];
    }
}
@end
